GOCMD=GO111MODULE=on go
GOBUILD=$(GOCMD) build
GODOWNLOAD=$(GOCMD) mod download

download:
	$(GODOWNLOAD)

build:
	rm -rf target
	mkdir target
	#cp ./congit.toml.template target/config.toml
	$(GOBUILD) -o target/bmember ./main.go

clean:
	rm -rf target

dev:
	go run main.go member -c=config-example.toml

run:
	nohup target/bmember member -c=target/config.toml 2>&1 > target/member.log &

stop:
	pkill -f target/bmember member

proto:
	protoc -I=. -I=$(GOPATH)/src --gofast_out=plugins=grpc:./api/pb/server ./api/proto/server/*.proto
	protoc -I=. -I=$(GOPATH)/src --gofast_out=plugins=grpc:./api/pb/client ./api/proto/client/permission.proto
	protoc -I=. -I=$(GOPATH)/src --gofast_out=plugins=grpc:./api/pb/client ./api/proto/client/bilin_open.proto
	protoc -I=. -I=$(GOPATH)/src --gofast_out=plugins=grpc:./api/pb/client ./api/proto/client/admin_vendor.proto
	protoc -I=. -I=$(GOPATH)/src --gofast_out=plugins=grpc:./api/pb/client ./api/proto/client/sms.proto
	protoc -I=. -I=$(GOPATH)/src --gofast_out=plugins=grpc:./api/pb/client ./api/proto/client/bilin_pay.proto
	sed -i "" -e "s/,omitempty//g" ./api/pb/server/*.go
